home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / cswsk10.zip / udpecho.frm < prev    next >
Text File  |  1995-07-01  |  4KB  |  136 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   3645
  5.    ClientLeft      =   2565
  6.    ClientTop       =   2280
  7.    ClientWidth     =   5685
  8.    Height          =   4050
  9.    Left            =   2505
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3645
  12.    ScaleWidth      =   5685
  13.    Top             =   1935
  14.    Width           =   5805
  15.    Begin Socket Socket1 
  16.       Backlog         =   1
  17.       Binary          =   -1  'True
  18.       Blocking        =   -1  'True
  19.       Broadcast       =   0   'False
  20.       BufferSize      =   0
  21.       HostAddress     =   ""
  22.       HostFile        =   ""
  23.       HostName        =   ""
  24.       InLine          =   0   'False
  25.       Interval        =   0
  26.       KeepAlive       =   0   'False
  27.       Left            =   1680
  28.       Linger          =   0
  29.       LocalPort       =   0
  30.       LocalService    =   ""
  31.       Peek            =   0   'False
  32.       Protocol        =   0
  33.       RecvLen         =   0
  34.       RemotePort      =   0
  35.       RemoteService   =   ""
  36.       ReuseAddress    =   0   'False
  37.       Route           =   -1  'True
  38.       SendLen         =   0
  39.       TabIndex        =   5
  40.       Timeout         =   0
  41.       Top             =   3120
  42.       Type            =   1
  43.       Urgent          =   0   'False
  44.    End
  45.    Begin CommandButton Command1 
  46.       Caption         =   "Close"
  47.       Height          =   375
  48.       Left            =   2400
  49.       TabIndex        =   4
  50.       Top             =   3120
  51.       Width           =   1215
  52.    End
  53.    Begin TextBox Text1 
  54.       Height          =   285
  55.       Left            =   240
  56.       TabIndex        =   3
  57.       Top             =   2640
  58.       Width           =   5175
  59.    End
  60.    Begin TextBox HostName 
  61.       Height          =   285
  62.       Left            =   960
  63.       TabIndex        =   1
  64.       Top             =   240
  65.       Width           =   4455
  66.    End
  67.    Begin ListBox List1 
  68.       Height          =   1980
  69.       Left            =   240
  70.       TabIndex        =   2
  71.       Top             =   600
  72.       Width           =   5175
  73.    End
  74.    Begin Label Label1 
  75.       AutoSize        =   -1  'True
  76.       BackStyle       =   0  'Transparent
  77.       Caption         =   "&System:"
  78.       Height          =   195
  79.       Left            =   240
  80.       TabIndex        =   0
  81.       Top             =   240
  82.       Width           =   675
  83.    End
  84. End
  85. Option Explicit
  86.  
  87. Sub Command1_Click ()
  88.     Unload Me
  89. End Sub
  90.  
  91. Sub Form_Load ()
  92.     '
  93.     ' Initialize the socket control
  94.     '
  95.     Socket1.AddressFamily = AF_INET
  96.     Socket1.Binary = True
  97.     Socket1.Blocking = False
  98.     Socket1.Protocol = IPPROTO_IP
  99.     Socket1.Type = SOCK_DGRAM
  100.     Socket1.LocalPort = IPPORT_ECHO
  101.     Socket1.RemotePort = IPPORT_ECHO
  102.     Socket1.Action = SOCKET_OPEN
  103. End Sub
  104.  
  105. Sub Form_Unload (Cancel As Integer)
  106.     If Socket1.Handle <> -1 Then Socket1.Action = SOCKET_CLOSE
  107. End Sub
  108.  
  109. Sub HostName_GotFocus ()
  110.     HostName.SelStart = 0
  111.     HostName.SelLength = Len(HostName.Text)
  112. End Sub
  113.  
  114. Sub Socket1_Error (ErrCode As Integer, ErrMsg As String, Response As Integer)
  115.     MsgBox ErrMsg
  116. End Sub
  117.  
  118. Sub Socket1_Read (DataLength As Integer, IsUrgent As Integer)
  119.     Socket1.RecvLen = DataLength
  120.     List1.AddItem Socket1.RecvData
  121.     List1.ListIndex = List1.ListCount - 1
  122.     List1.Selected(List1.ListIndex) = False
  123. End Sub
  124.  
  125. Sub Text1_KeyPress (KeyAscii As Integer)
  126.     If KeyAscii = 13 Then
  127.         On Error Resume Next
  128.         Socket1.HostName = Trim$(HostName.Text)
  129.         If Err <> 0 Then Exit Sub
  130.         Socket1.SendLen = Len(Text1.Text)
  131.         Socket1.SendData = Text1.Text
  132.         Text1.Text = "": KeyAscii = 0
  133.     End If
  134. End Sub
  135.  
  136.